//
// Created by Semir on 2020/4/26.
//

#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

struct Person {
    int left;
    int right;
    int product;
};

const int MAX_M = 1005;
const int MAX_LEN = 4005;
int num;
vector<int> pro;
vector<int> rwd;
Person* persons[MAX_M];

bool cmp(Person* p1, Person* p2) {
    return p1->product < p2->product;
}

void highPrecisionMulti(int &len, int factor) {
    for (int i = 0; i < len; i++) {
        pro[i] *= factor;
    }
    int i = 0;
    for (; i < len || pro[i] != 0; i++) {
        pro[i + 1] += pro[i] / 10;
        pro[i] %= 10;
    }
    if (i >= len) {
        len = i;
    }
}

void compareSetRwd(int proLen, int &rwdLen, int divisor) {
    //高精除法
//    int* res = new int[MAX_LEN];
    vector<int> res(MAX_LEN);
    int resLen = proLen;
//    for (int i = proLen - 1; i >= 0; i--) {
//        res[i] = 0;
//    }
    for (int i = proLen - 1; i >= 0; i--) {
        res[i] += pro[i];
        res[i - 1] += (res[i] % divisor) * 10;
        res[i] /= divisor;
    }
    res[0] += pro[0];
    res[0] /= divisor;
    for (int i = resLen; i >= 0; i--) {
        if (res[i] == 0) {
            resLen--;
        } else {
            break;
        }
    }

    bool shouldSet = false;
    //比较
    if (resLen > rwdLen) {
        shouldSet = true;
    } else if (resLen == rwdLen) {
        for (int i = resLen - 1; i >= 0; i--) {
            if (res[i] != rwd[i]) {
                if (res[i] > rwd[i]) {
                    shouldSet = true;
                }
                break;
            }
        }
    }
    //设值
    if (shouldSet) {
        for (int i = 0; i < resLen; i++) {
            rwd[i] = res[i];
        }
        rwdLen = resLen;
    }

}

int main() {
    pro.resize(MAX_LEN);
    rwd.resize(MAX_LEN);
    cin >> num;
    persons[0] = new Person;
    cin >> persons[0]->left >> persons[0]->right;
    for (int i = 1; i <= num; i++) {
        persons[i] = new Person;
        cin >> persons[i]->left >> persons[i]->right;
        persons[i]->product = persons[i]->left * persons[i]->right;
    }
    sort(persons + 1, persons + 1 + num, cmp);
    int proLen = 1, rwdLen = 1;
    pro[0] = 1;
    highPrecisionMulti(proLen, persons[0]->left);
    for (int i = 1; i <= num; i++) {
        compareSetRwd(proLen, rwdLen, persons[i]->right);
        highPrecisionMulti(proLen, persons[i]->left);
    }
    for (int i = rwdLen - 1; i >= 0; i--) {
        cout << rwd[i];
    }
    return 0;
}
